<template>
	<view>
		<view v-for="(item,index) in datalist" :key="item.nID" style="margin: 10rpx;">
			<CustomTextView 
				:nid="item.nID" 
				:title="item.title" 
				:isTop="item.isTop"
				:author="item.author" 
				:comments="item.comments" 
				:time="item.time"
				@click="onCustomViewClick(index)"
			>
			</CustomTextView>
		</view>
	</view>
</template>

<script>
	import CustomTextView from "@/components/cardViewText.vue"
	export default {
		components: {
			CustomTextView
		},
		data() {
			return {
				datalist: [
					{
						nID: "K2025111",
						title: "我国首款商用可重复使用火箭成功完成回收试验 降低发射成本80%",
						isTop: true,
						author: "科技日报",
						comments: 3568,
						time: "2025.11.17"
					},
					{
						nID: "C2025112",
						title: "《非遗里的中国·秋冬篇》开播 聚焦苏绣、藏香等12项冷门技艺传承",
						isTop: false,
						author: "央视网",
						comments: 1245,
						time: "2025.11.16"
					},
					{
						nID: "M2025113",
						title: "全国多地启动冬季供暖 智慧供热系统覆盖超2亿户居民",
						isTop: true,
						author: "人民日报",
						comments: 2890,
						time: "2025.11.18"
					},
					{
						nID: "E2025114",
						title: "全球首条“风光储氢”一体化沙漠能源走廊正式投运 年供电超500亿度",
						isTop: false,
						author: "中国能源报",
						comments: 1983,
						time: "2025.11.15"
					},
					{
						nID: "H2025115",
						title: "新版国家基本医保药品目录落地 新增76种罕见病用药纳入报销",
						isTop: true,
						author: "健康中国",
						comments: 4217,
						time: "2025.11.17"
					},
					{
						nID: "T2025116",
						title: "我国首条跨海高铁海底隧道贯通 福州至厦门最快45分钟可达",
						isTop: false,
						author: "中国交通报",
						comments: 2654,
						time: "2025.11.16"
					},
					{
						nID: "A2025117",
						title: "AI大模型赋能中小学编程教育 全国3000所学校试点智慧课堂",
						isTop: false,
						author: "中国教育新闻网",
						comments: 1579,
						time: "2025.11.15"
					},
					{
						nID: "N2025118",
						title: "长江口中华鲟自然保护区监测到近10年最多幼鱼种群 生态修复见效",
						isTop: true,
						author: "中国环境报",
						comments: 3126,
						time: "2025.11.18"
					}
				]
			}
		},
		methods: {
			onCustomViewClick(index) {
				console.log(`点击了第${index+1}条新闻：${this.datalist[index].title}`);
				// 可扩展：跳转至新闻详情页，如 uni.navigateTo({ url: `/pages/detail/detail?nid=${this.datalist[index].nID}` })
			}
		}
	}
</script>

<style>

</style>